package synchronizedTest;
public class TwoThread {
    private static Object A = new Object();
    private  static Object B = new Object();
    private static int count = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            synchronized (A) {
                System.out.println("t1进入锁A，，，尝试获取锁B");
                synchronized (B) {
                    count++;
                }

            }
        });
        Thread t2 = new Thread(()->{
            synchronized (B) {
                System.out.println("t2进入锁B，，，尝试获取锁A");
                synchronized (A) {
                    count++;
                }
            }
        });
        t1.start();
        t2.start();
        System.out.println("A锁："+A);
        System.out.println("B锁："+B);
    }
}
